<?php
/**
 * Created by PhpStorm.
 * User: cape
 * Date: 2017/11/14
 * Time: 8:31
 */
header('content-type:text/html;charset=utf-8');

$i =1;
$j = 2;
function test1(){
    var_dump($i, $j);
}


//test1();
function test2(){
    global $i;
    global $j;
    var_dump($i, $j);
}

test2();


function test3(){
    global $i, $j;
    var_dump($i, $j);
    $i = 3;
    $j = 5;
}

test3();
var_dump($i, $j);


$username = 'king';
$age = 12;
$email = "123423@qq.com";

echo '<hr/>';

print_r($GLOBALS);


function test4(){
    echo '用户名为：'.$GLOBALS['username'].'<br/>';
    echo '年龄'.$GLOBALS['age'].'<br/>';
    echo '邮箱为：'.$GLOBALS['email'].'<br/>';

}

test4();
var_dump($age);


























